#!/usr/bin/php
<?php    
require_once "autoload.php";

$jabber = new Zend_Jabber();
$jabber->connect('jabber.org', 5222);

$user = Zend_Jabber_User::getInstance("phpjabberlib@jabber.org");

$jabber->login($user, 'test');
$jabber->message(Zend_Jabber_User::getInstance("sandrejev@gmail.com"), 'asdasdas');


$jabber->disconnect();
die();

function printMessage($response) { $response->getBody();}
$jabber->registerCallback("Message.Chat", "printMessage");

$jabber->login(Zend_Jabber_User::getInstance("friend@akl.lt/Gaim"), 'test');
  
echo $jabber->getAddressBook();

//while($jabber->receive());

die();
// Print user address book
echo $jabber->getAddressBook();

// Send user a message
$jabber->message($friend, 'asdasdas');

// Add a friend to owner roster
$jabber->setContact($friend, array('Buddies', 'Friends', 'Enemies'));
echo $jabber->getAddressBook();

// Change friend's groups
$jabber->setContact($friend);
echo $jabber->getAddressBook();

// Remove friend from roster
$jabber->removeContact($friend);
echo $jabber->getAddressBook();


// Unsubscribe
$jabber->unsubscribe($friend);
echo $jabber->getAddressBook();

// Start a loop and wait for any response to arrive
while($response = $jabber->receive());

$jabber->register(new User("test2@$domain.com"), "test");

// Close connection
$jabber->disconnect();
?>